package com.happyghost.thread.threadapi;

public class YieldExampleClient {

    public static void main(String[] args) {
        Thread xiaoming = new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                System.out.println("小明--" + i);
//                if (i == 2) {
//                    Thread.yield();
//                }
            }
        });

        Thread jianguo = new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                System.out.println("建国--" + i);
            }
        });

        xiaoming.start();
        jianguo.start();
    }
}